﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Control.Dal;

namespace Control.Bus
{
    public class BusShelf
    {
        public int ID { get; set; }
        public string ShelfName { get; set; }
        public string Tray { get; set; }
        public bool Isnormal { get; set; }
        public int soSP
        {
            get { return SoSP(); }
        }
        private int SoSP()
        {
            List<BusProduct> products = DalProduct.GetListByIDKe(this.ID);
            return products.Count;
        }

        internal static BusShelf GetByID(int p)
        {
            return DalShelf.GetByID(p);
        }

        public static List<BusShelf> GetAll()
        {
            return DalShelf.GetAll();
        }

        public static List<BusShelf> GetListByShelfName(string shelfname)
        {
            return DalShelf.GetListByShelfName(shelfname);
        }

        public void Insert()
        {
            ID = DalShelf.Insert(this);
        }

        public void Update()
        {
            DalShelf.Update(this);
        }

        public void Delete()
        {
            DalShelf.Delete(this);
        }
    }
}
